<!--<link href="/assets/css/dashboard.css" rel="stylesheet" />-->
{:doAction('admin_dashboard_head')}
<style>
    .row-advert p{
        margin-bottom: 0;
    }
</style>

<div class="panel-default panel-intro">
    {:doAction('admin_dashboard_upgrade')}


    <div class="alert" role="alert" style="background: #4e73df; color: #fff; font-weight: bold;">
        <div class="flex items-center set-a" style="display: inline-block;">
            <span id="init-version">
                系统版本 v<span id="version">{$options.version}</span>

                <a href="javascript:;" id="check-update">检测更新</a>
            </span>
        </div>
        <span style="width: 100px; float: right;"><a href="http://hmbbs.buzz/forum.php?mod=forumdisplay&fid=2" target="_blank">更新记录 →</a></span>
    </div>

    <div class="row" style="margin-top:15px;" id="statistics">

        <div class="col-lg-12">
        </div>
        <div class="col-xs-6 col-md-3">
            <div class="panel bg-blue-gradient no-border">
                <div class="panel-body">
                    <div class="panel-content">
                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="no-margins">{$user_total}</h1>
                                <div class="font-bold"><i class="fa fa-magic"></i>
                                    <small>用户总数</small>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <h1 class="no-margins">{$today_register}</h1>
                                <div class="font-bold"><i class="fa fa-magic"></i>
                                    <small>今日注册</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-xs-6 col-md-3">
            <div class="panel bg-teal-gradient no-border">
                <div class="panel-body">
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="no-margins">{$category_total}</h1>
                                <div class="font-bold"><i class="fa fa-database"></i>
                                    <small>分类数量</small>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <h1 class="no-margins">{$goods_total}</h1>
                                <div class="font-bold"><i class="fa fa-filter"></i>
                                    <small>商品数量</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-xs-6 col-md-3">
            <div class="panel bg-purple-gradient no-border">
                <div class="panel-body">
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="no-margins">{$today_order}</h1>
                                <div class="font-bold"><i class="fa fa-files-o"></i>
                                    <small>今日订单</small>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <h1 class="no-margins">{$today_wait_order}</h1>
                                <div class="font-bold"><i class="fa fa-filter"></i>
                                    <small>待处理订单</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-xs-6 col-md-3">
            <div class="panel bg-green-gradient no-border">
                <div class="panel-body">
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-md-6">
                                <h1 class="no-margins">{$today_order_money}</h1>
                                <div class="font-bold"><i class="fa fa-picture-o"></i>
                                    <small>今日成交金额</small>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <h1 class="no-margins">{$today_order_profit}</h1>
                                <div class="font-bold"><i class="fa fa-filter"></i>
                                    <small>今日利润</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <div class="row row-advert" id="poster-box" data-exists="{:$poster ? 'true' : 'false'}">
        <div class="col-xs-12 col-md-6">
            <table class="table table-striped table-bordered" style="background: #fff;">
                <thead>
                    <tr>
                        <th class="px-3 py-3">联盟推广<a href="{:$poster ? $poster.poster_url : 'javascript:;'}" id="poster_url" target="_blank" style="float: right;">我要推广</a></th>
                    </tr>
                </thead>
                <tbody class="" id="poster-list">
                    {if condition="$poster"}
                    {volist name="$poster.poster" id="vo"}
                    <tr>
                        <td class="px-4 py-2">
                            <a href="{$vo.url}" target="_blank">
                                {$vo.content}
                            </a>
                        </td>
                    </tr>
                    {/volist}
                    {/if}
                </tbody>
            </table>
        </div>
        <div class="col-xs-12 col-md-6">
            <table class="table table-striped table-bordered" style="background: #fff;">
                    <thead>
                        <tr>
                            <th class="px-3 py-3">官方公告<a href="https://blog.ysxue.net/" target="_blank" style="float: right;">官方网站</a></th>
                        </tr>
                    </thead>
                    <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800" id="notice-list">
                        {if condition="$poster"}
                        {volist name="$poster.notice" id="vo"}
                        <tr class="text-gray-700 dark:text-gray-400">
                            <td class="px-4 py-2">
                                <a href="{$vo.url}" target="_blank">
                                    {$vo.content}
                                </a>
                            </td>
                        </tr>
                        {/volist}
                        {/if}
                    </tbody>
                </table>
        </div>
    </div>


    <div class="row " style="margin-bottom: 20px;">
        <div style="display: none;">
            <textarea id="sts-order-date">{:json_encode($sts_order.date)}</textarea>
            <textarea id="sts-order-order-count">{:json_encode($sts_order.order_count)}</textarea>
            <textarea id="sts-order-sales-money">{:json_encode($sts_order.sales_money)}</textarea>
        </div>
        <div class="col-md-12">
            <div id="lineChart" style="width: 100%;height:400px; background: #fff; padding: 10px;"></div>
        </div>

    </div>


    <div class="row">
        <div class="col-xs-12 col-md-6">
            <table class="table table-striped table-bordered" style="background: #fff;">
                <thead>
                    <tr>
                        <th class="px-4 py-3">商品销量Top10</th>
                        <th class="px-4 py-3">商品名称</th>
                        <th class="px-4 py-3">销售额</th>
                        <th class="px-4 py-3">销量</th>
                    </tr>
                </thead>
                <tbody>
                    {volist name="$goods_list" id="vo" key="key"}
                    <tr class="text-gray-700 dark:text-gray-400">
                        <td class="px-4 py-2">{$key}</td>
                        <td class="px-4 py-2">{:substrCn($vo.name, 28)}</td>
                        <td class="px-4 py-2">&yen; {$vo.sales_money}</td>
                        <td class="px-4 py-2">{$vo.sales}</td>
                    </tr>
                    {/volist}
                </tbody>
            </table>
        </div>
        <div class="col-xs-12 col-md-6">
            <table class="table table-striped table-bordered" style="background: #fff;">
                <thead>
                    <tr>
                        <th class="px-4 py-3">用户消费Top10 (不统计游客)</th>
                        <th class="px-4 py-3">用户账号</th>
                        <th class="px-4 py-3">订单数量</th>
                        <th class="px-4 py-3">消费金额</th>
                    </tr>
                </thead>
                <tbody>
                    {volist name="user_list" id="vo" key="key"}
                    <tr class="text-gray-700 dark:text-gray-400">
                        <td class="px-4 py-2">{$key}</td>
                        <td class="px-4 py-2">{$vo.nickname}</td>
                        <td class="px-4 py-2">{$vo.order_count}</td>
                        <td class="px-4 py-2">&yen; {$vo.consume}</td>
                    </tr>
                    {/volist}
                </tbody>
            </table>
        </div>
    </div>

</div>
<span id="upgrade" data-upgrade="{:isset($upgrade.version) ? $upgrade.version : 0}"></span>
<textarea style="display: none;" id="upgrade-content">{:empty($upgrade.content) ? '' : $upgrade.content}</textarea>
<script id="upgrade_tpl" type="text/html">
    <div>
        <form class="form-horizontal">
            <fieldset style="text-align: center;" id="upgrade-text">
                <p style="color: #f75444; font-weight: bold; font-size: 15px;">发现新版本，老版本即刻起停止维护，建议您立即更新！</p>
                <p style="color: #f75444; font-weight: bold; font-size: 15px;">更新前请先备份网站文件及数据库，避免更新异常导致网站无法访问！</p>
                <p style="color: #f75444; font-weight: bold; font-size: 15px;">如更新过程出现任何问题，请及时联系官方人员获取免费协助！</p>
                <%=#upgrade_content%>
            </fieldset>
        </form>
    </div>
</script>
